using System;
using System.Xml.Serialization;

namespace ElfBinary
{
	public enum e_type:ushort
	{
		NoFileType =	0,
		RelocatableFile= 	1,
		ExecutableFile= 	2,
		SharedObjectFile= 	3,
		CoreFile=	4 ,
		OperatingSystemSpecificLo=0xfe00,
		OperatingSystemSpecificHi=	0xfeff,
		ProcessorSpecificLo=	0xff00,
		ProcessorSpecificHi= 	0xffff 	
	}


	public enum ElfClass:byte
	{
		None = 0,
		Elf32Bit = 1,
		Elf64Bit = 2
	}

	/// <summary>
	/// Elf data
	/// </summary>
	///<remarks> A file's data encoding specifies how to interpret the basic objects in a file. Class ELFCLASS32 files use objects that occupy 1, 2, and 4 bytes. Class ELFCLASS64 files use objects that occupy 1, 2, 4, and 8 bytes. Under the defined encodings, objects are represented as shown below.
	///
	///Encoding ELFDATA2LSB specifies 2's complement values, with the least significant byte occupying the lowest address.
	///Figure 4-5: Data Encoding ELFDATA2LSB, byte address zero on the left
	///
	///01
	///0x01
	///
	///02 	01
	///0x0102
	///
	///04 	03 	02 	01
	///0x01020304
	///
	///08 	07 	06 	05 	04 	03 	02 	01
	///0x0102030405060708
	///
	///Encoding ELFDATA2MSB specifies 2's complement values, with the most significant byte occupying the lowest address.
	///Figure 4-6: Data Encoding ELFDATA2MSB, byte address zero on the left
	///
	///01
	///0x01
	///
	///01 	02
	///0x0102
	///
	///01 	02 	03 	04
	///0x01020304
	///
	///01 	02 	03 	04 	05 	06 	07 	08</remarks>
	public enum ElfData:byte
	{
		None = 0,
		LSB = 1,
		MSB=2
	}

	public enum ElfABI:byte
	{
		None = 0,
		HP = 1,
		NetBSD = 2,
		GNULinux = 3,
		Solaris = 6,
		AIX = 7,
		IRIX=8,
		FreeBSD=9,
		CompaqUnix=10,
		Modesto = 11,
		OpenBSD = 12,
		OpenVMS=13,
		HPNonStopKernel=14,
		AmigaResearch=15,
		FenixOs= 16

	}

	public enum ElfType:ushort
	{
		None = 0,
		RelocatableFile=1,
		ExecutableFile = 2,
		SharedObjectFile=3,
		CoreFile = 4,
		LoOs = 0xfe00,
		HiOs = 0xfeff,
		LoProc = 0xff00,
		HiProc = 0xffff
	}

	public enum ElfMachine:ushort
	{
		No_machine	=	0	,
		ATT_WE_32100	=	1	,
		SPARC	=	2	,
		Intel_80386	=	3	,
		Motorola_68000	=	4	,
		Motorola_88000	=	5	,
		Intel_80860	=	7	,
		MIPS_I_Architecture	=	8	,
		IBM_System370_Processor	=	9	,
		MIPS_RS3000_Little_endian	=	10	,
		Hewlett_Packard_PA_RISC	=	15	,
		Fujitsu_VPP500	=	17	,
		Enhanced_instruction_set_SPARC	=	18	,
		Intel_80960	=	19	,
		PowerPC	=	20	,
		m_64bitPowerPC	=	21	,
		IBM_System390_Processor	=	22	,
		IBM_SPUSPC	=	23	,
		NEC_V800	=	36	,
		Fujitsu_FR20	=	37	,
		TRW_RH_32	=	38	,
		Motorola_RCE	=	39	,
		ARM_32_bit_architecture_AARCH32	=	40	,
		Digital_Alpha	=	41	,
		Hitachi_SH	=	42	,
		SPARC_Version_9	=	43	,
		Siemens_TriCore_embedded_processor	=	44	,
		Argonaut_RISC_Core,_Argonaut_Technologies_Inc	=	45	,
		Hitachi_H8300	=	46	,
		Hitachi_H8300H	=	47	,
		Hitachi_H8S	=	48	,
		Hitachi_H8500	=	49	,
		Intel_IA_64_processor_architecture	=	50	,
		Stanford_MIPS_X	=	51	,
		Motorola_ColdFire	=	52	,
		Motorola_M68HC12	=	53	,
		Fujitsu_MMA_Multimedia_Accelerator	=	54	,
		Siemens_PCP	=	55	,
		Sony_nCPU_embedded_RISC_processor	=	56	,
		Denso_NDR1_microprocessor	=	57	,
		Motorola_StarCore_processor	=	58	,
		Toyota_ME16_processor	=	59	,
		STMicroelectronics_ST100_processor	=	60	,
		Advanced_Logic_Corp_TinyJ_embedded_processor_family	=	61	,
		AMD_x86_64_architecture	=	62	,
		Sony_DSP_Processor	=	63	,
		Digital_Equipment_Corp_PDP_10	=	64	,
		Digital_Equipment_Corp_PDP_11	=	65	,
		Siemens_FX66_microcontroller	=	66	,
		STMicroelectronics_ST9_816_bit_microcontroller	=	67	,
		STMicroelectronics_ST7_8_bit_microcontroller	=	68	,
		Motorola_MC68HC16_Microcontroller	=	69	,
		Motorola_MC68HC11_Microcontroller	=	70	,
		Motorola_MC68HC08_Microcontroller	=	71	,
		Motorola_MC68HC05_Microcontroller	=	72	,
		Silicon_Graphics_SVx	=	73	,
		STMicroelectronics_ST19_8_bit_microcontroller	=	74	,
		Digital_VAX	=	75	,
		Axis_Communications_32_bit_embedded_processor	=	76	,
		Infineon_Technologies_32_bit_embedded_processor	=	77	,
		Element_14_64_bit_DSP_Processor	=	78	,
		LSI_Logic_16_bit_DSP_Processor	=	79	,
		Donald_Knuth_educational_64_bit_processor	=	80	,
		Harvard_University_machine_independent_object_files	=	81	,
		SiTera_Prism	=	82	,
		Atmel_AVR_8_bit_microcontroller	=	83	,
		Fujitsu_FR30	=	84	,
		Mitsubishi_D10V	=	85	,
		Mitsubishi_D30V	=	86	,
		NEC_v850	=	87	,
		Mitsubishi_M32R	=	88	,
		Matsushita_MN10300	=	89	,
		Matsushita_MN10200	=	90	,
		picoJava	=	91	,
		OpenRISC_32_bit_embedded_processor	=	92	,
		ARC_International_ARCompact_processor_old_spellingsynonym_EM_ARC_A5	=	93	,
		Tensilica_Xtensa_Architecture	=	94	,
		Alphamosaic_VideoCore_processor	=	95	,
		Thompson_Multimedia_General_Purpose_Processor	=	96	,
		National_Semiconductor_32000_series	=	97	,
		Tenor_Network_TPC_processor	=	98	,
		Trebia_SNP_1000_processor	=	99	,
		STMicroelectronics_wwwstcom_ST200_microcontroller	=	100	,
		Ubicom_IP2xxx_microcontroller_family	=	101	,
		MAX_Processor	=	102	,
		National_Semiconductor_CompactRISC_microprocessor	=	103	,
		Fujitsu_F2MC16	=	104	,
		Texas_Instruments_embedded_microcontroller_msp430	=	105	,
		Analog_Devices_Blackfin_DSP_processor	=	106	,
		S1C33_Family_of_Seiko_Epson_processors	=	107	,
		Sharp_embedded_microprocessor	=	108	,
		Arca_RISC_Microprocessor	=	109	,
		Microprocessor_series_from_PKU_Unity_Ltd_and_MPRC_of_Peking_University	=	110	,
		eXcess_163264_bit_configurable_embedded_CPU	=	111	,
		Icera_Semiconductor_Inc_Deep_Execution_Processor	=	112	,
		Altera_Nios_II_soft_core_processor	=	113	,
		National_Semiconductor_CompactRISC_CRX_microprocessor	=	114	,
		Motorola_XGATE_embedded_processor	=	115	,
		Infineon_C16xXC16x_processor	=	116	,
		Renesas_M16C_series_microprocessors	=	117	,
		Microchip_Technology_dsPIC30F_Digital_Signal_Controller	=	118	,
		Freescale_Communication_Engine_RISC_core	=	119	,
		Renesas_M32C_series_microprocessors	=	120	,
		Altium_TSK3000_core	=	131	,
		Freescale_RS08_embedded_processor	=	132	,
		Analog_Devices_SHARC_family_of_32_bit_DSP_processors	=	133	,
		Cyan_Technology_eCOG2_microprocessor	=	134	,
		Sunplus_Score7_RISC_processor	=	135	,
		New_Japan_Radio_NJR_24_bit_DSP_Processor	=	136	,
		Broadcom_VideoCore_III_processor	=	137	,
		RISC_processor_for_Lattice_FPGA_architecture	=	138	,
		Seiko_Epson_C17_family	=	139	,
		The_Texas_Instruments_TMS320C6000_DSP_family	=	140	,
		The_Texas_Instruments_TMS320C2000_DSP_family	=	141	,
		The_Texas_Instruments_TMS320C55x_DSP_family	=	142	,
		STMicroelectronics_64bit_VLIW_Data_Signal_Processor	=	160	,
		Cypress_M8C_microprocessor	=	161	,
		Renesas_R32C_series_microprocessors	=	162	,
		NXP_Semiconductors_TriMedia_architecture_family	=	163	,
		QUALCOMM_DSP6_Processor	=	164	,
		Intel_8051_and_variants	=	165	,
		STMicroelectronics_STxP7x_family_of_configurable_and_extensible_RISC_processors	=	166	,
		Andes_Technology_compact_code_size_embedded_RISC_processor_family	=	167	,
		Cyan_Technology_eCOG1X_family	=	168	,
	
		Dallas_Semiconductor_MAXQ30_Core_Micro_controllers	=	169	,
		New_Japan_Radio_NJR_16_bit_DSP_Processor	=	170	,
		M2000_Reconfigurable_RISC_Microprocessor	=	171	,
		Cray_Inc_NV2_vector_architecture	=	172	,
		Renesas_RX_family	=	173	,
		Imagination_Technologies_META_processor_architecture	=	174	,
		MCST_Elbrus_general_purpose_hardware_architecture	=	175	,
		Cyan_Technology_eCOG16_family	=	176	,
		National_Semiconductor_CompactRISC_CR16_16_bit_microprocessor	=	177	,
		Freescale_Extended_Time_Processing_Unit	=	178	,
		Infineon_Technologies_SLE9X_core	=	179	,
		Intel_L10M	=	180	,
		Intel_K10M	=	181	,
		ARM_64_bit_architecture_AARCH64	=	183	,
		Atmel_Corporation_32_bit_microprocessor_family	=	185	,
		STMicroeletronics_STM8_8_bit_microcontroller	=	186	,
		Tilera_TILE64_multicore_architecture_family	=	187	,
		Tilera_TILEPro_multicore_architecture_family	=	188	,
		Xilinx_MicroBlaze_32_bit_RISC_soft_processor_core	=	189	,
		NVIDIA_CUDA_architecture	=	190	,
		Tilera_TILE_Gx_multicore_architecture_family	=	191	,
		CloudShield_architecture_family	=	192	,
		KIPO_KAIST_Core_A_1st_generation_processor_family	=	193	,
		KIPO_KAIST_Core_A_2nd_generation_processor_family	=	194	,
		Synopsys_ARCompact_V2	=	195	,
		Open8_8_bit_RISC_soft_processor_core	=	196	,
		Renesas_RL78_family	=	197	,
		Broadcom_VideoCore_V_processor	=	198	,
		Renesas_78KOR_family	=	199	,
		Freescale_56800EX_Digital_Signal_Controller_DSC	=	200	,
		Beyond_BA1_CPU_architecture	=	201	,
		Beyond_BA2_CPU_architecture	=	202	,
		XMOS_xCORE_processor_family	=	203	,
		Microchip_8_bit_PIC_r_family	=	204	,
		KM211_KM32_32_bit_processor	=	210	,
		KM211_KMX32_32_bit_processor	=	211	,
		KM211_KMX16_16_bit_processor	=	212	,
		KM211_KMX8_8_bit_processor	=	213	,
		KM211_KVARC_processor	=	214	,
		Paneve_CDP_architecture_family	=	215	,
		Cognitive_Smart_Memory_Processor	=	216	,
		iCelero_CoolEngine	=	217	
	}

	public enum ElfVersion:uint
	{
		Invalid=0,
		Current = 1
	}

	public enum ElfSectionType:uint
	{

		/// <summary>
		/// SH_NULL
		/// </summary>
		Inactive	=	0	,
		/// <summary>
		/// SH_PROGBITS
		/// </summary>
		DefinedByProgram	=	1	,
		/// <summary>
		/// SHT_SYMTAB
		/// </summary>
		SymbolTable	=	2	,
		/// <summary>
		/// SHT_STRTAB
		/// </summary>
		StringTable	=	3	,
		/// <summary>
		/// SHT_RELA
		/// </summary>
		RelocationEntries	=	4	,
		/// <summary>
		/// SHT_HASH
		/// </summary>
		SymbolHashTable	=	5	,
		/// <summary>
		/// SHT_DYNAMIC
		/// </summary>
		DynamicLinkingInfo	=	6	,
		/// <summary>
		/// SHT_NOTE
		/// </summary>
		Notes	=	7	,
		/// <summary>
		/// SHT_NOBITS
		/// </summary>
		NoBits	=	8	,
		/// <summary>
		/// SHT_REL
		/// </summary>
		ImplicitRelocation	=	9	,
		/// <summary>
		/// SHT_SHLIB
		/// </summary>
		ReservedLibsSection	=	10	,
		/// <summary>
		/// SHT_DYNSYM
		/// </summary>
		DynamicLinkingSymbols	=	11	,
		/// <summary>
		/// SHT_INIT_ARRAY
		/// </summary>
		InitializationFunctionPointers	=	14	,
		/// <summary>
		/// SHT_FINI_ARRAY
		/// </summary>
		TerminationFunctionPointers	=	15	,
		/// <summary>
		/// SH_PREINIT_ARRAY
		/// </summary>
		PreinitialzationFunctionPointers	=	16	,
		/// <summary>
		/// SH_GROUP
		/// </summary>
		SectionGroup	=	17	,
		/// <summary>
		/// SH_SYMTAB_SHNDX
		/// </summary>
		SymbolSectionHeaderIndexes	=	18	,
		/// <summary>
		/// SHT_LOOS
		/// </summary>
		ReservedLoOOSSspecifcSemantics	=	0x60000000	,
		/// <summary>
		/// SHT_HIOS
		/// </summary>
		ReservedHiOOSSspecifcSemantics	=	0x6fffffff	,
		/// <summary>
		/// SHT_LOPROC
		/// </summary>
		ReservedLoProcessorSpecificSemantics	=	0x70000000	,
		/// <summary>
		/// SHT_HIPROC
		/// </summary>
		ReservedHiProcessorSpecificSemantics	=	0x7fffffff	,
		/// <summary>
		/// SHT_LOUSER
		/// </summary>
		LowerBoundIndexesForApplications	=	0x80000000	,
		/// <summary>
		/// SHT_HIUSER
		/// </summary>
		UpperBoundIndexesForApplications	=	0xffffff	,
	}

	[Flags]
	public enum ElfSectionAttributeFlags:uint
	{
		WritableData =	0x1,
		Memory =	0x2,
		ExecutableMachineLanguage =	0x4,
		MergedElements=	0x10,
		NullTerminatedStrings = 	0x20,
		SectionaHeaderTableIndex =  	0x40,
		LinkInstructions =	0x80,
		OSSpecificProcessing =	0x100,
		SectionGroupMember = 0x200,
		ThreadLocalStorage = 	0x400,
		CompressedData= 	0x800,
		OperatingSystemMask= 	0x0ff00000,
		ProcessorMask= 	0xf0000000,
	}

	public enum ElfSymbolBinding:byte
	{
		Local = 0,
		Global = 1,
		Weak = 2,
		LoOs = 10,
		HiOs = 12,
		LoProc = 13,
		HiProc = 15
	}

	public enum ElfSymbolType:byte
	{
		NoType = 0,
		Object = 1,
		Function = 2,
		Section = 3,
		File = 4,
		Common = 5,
		TLS = 6,
		LoOs = 10,
		HiOs = 12,
		LoProc = 13,
		HiProc = 15
	}

	public enum ElfSymbolVisibility:byte
	{
		[XmlEnum("Default")]
		Default=0,
		[XmlEnum("Internal")]
		Internal=1,
		[XmlEnum("Hidden")]
		Hidden=2,
		[XmlEnum("Protected")]
		Protected=3
	}

}

